﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cocos2d;

namespace RunCircle
{
    public class Trap : CCSprite
    {
        //private float m_Angle;

        protected string m_TrapType;

        public bool m_bUsingTrap = true;

        public float width { set; get; }
        public float height { set; get; }

        public Trap()
        {
            this.Opacity = 0;
        }

        public virtual void setRotateByPoint(CCPoint playerpos, CCPoint anchopos, float rot, CCPoint rotateBy)
        {
            this.position = playerpos;

            if (width > 0.0f && height > 0.0f)
            {
                float ax = 0.5f - (rotateBy.x - anchopos.x) / width;
                float ay = 0.5f - (rotateBy.y - anchopos.y) / height;
                this.anchorPoint = new CCPoint(ax, ay);
            }
            else
            {
                //有问题;
            }

            this.rotation = rot;
        }

        public override void update(float dt)
        {
            base.update(dt);
        }

        public virtual bool checkCollision()
        {
            return false;
        }

        public string getTrapType()
        {
            return m_TrapType;
        }
    }
}
